﻿<%@ Page CodeFileBaseClass="AliCMS.Lib.SystemPageBase" %>
<script language="c#" runat="server">
protected bool CanDelete(DataRow record)
{
	DataRow[] rows = Manager.Channels.Select(Alias.Channel.ID + " IS NOT NULL AND " + Alias.Instance.InnerID + "=" + record[Alias.Instance.InnerID]);
	if (rows.Length == 0)
		return true;
	else
		return false;
}
</script>
<section data-page="instance_list" data-title="实例列表" data-lang="<%=ContentLang%>">
	<dl class="path1">
		<dt><span>您的位置：</span>实例列表</dt>
		<dd>
			<select data-class="<%=ContentLang%>Font" data-ali-widget="combo">
				<ali:List Object="Language" Source="Manager.Languages">
					<ali:Record>
						<%If Convert.ToString(Ab) == ContentLang%>
							<option value="<%=Ab%>" selected><%=[AliCMS.SystemModule.Alias.Language.Name + PageLang]%></option>
						<%Else%>
							<option value="<%=Ab%>"><%=[AliCMS.SystemModule.Alias.Language.Name + PageLang]%></option>
						<%EndIf%>
					</ali:Record>
				</ali:List>
			</select>
		</dd>
	</dl>
	<div class="ali-tabs sub-nav" data-height-style="fill" data-event="click">
		<div class="ali-tabs-header">
			<div class="ali-tabs-nav-container">
				<ul>
					<li class="ali-active"><a>实例列表</a></li>
					<li><a href="add.aspx?Lang=<%=ContentLang%>" target="ali-navtab">添加实例</a></li>
				</ul>				
			</div>
		</div>
		<div class="ali-tabs-body">
			<div class="ali-tabs-panel">
				<table data-ali-widget="grid" class="grid1">
					<thead>
						<tr>
							<th width="40">编号</th>
							<th>名称</th>
							<th width="80">多用户</th>
							<th width="60">菜单</th>
							<th width="80">删除</th>
						</tr>
					</thead>
					<tbody>
						<ali:List Object="Instance" Validate="True">
							<ali:Record>
								<tr data-id="<%=InnerID%>">
									<td data-sort="<%=InnerID%>" data-name="<%=Name%>" class="<%=ContentLang%>Font"><%=InnerID%></td>
									<td class="<%=ContentLang%>Font"><a href="edit.aspx?Lang=<%=ContentLang%>&amp;ID=<%=InnerID%>" target="ali-navtab"><%=Name%></a></td>
									<td>
										<%If Convert.ToBoolean(IsMultiUser)%>
											是
										<%Else%>
											否
										<%EndIf%>
									</td>
									<td><a href="" data-operation="ShowMenu">菜单</a></td>
									<td>
										<%If CanDelete(Record)%>
											<a class="ali-button" data-operation="Delete">删除</a>
										<%EndIf%>
									</td>
								</tr>
							</ali:Record>
						</ali:List>
					</tbody>
				</table>
			</div>
		</div>
		<div class="ali-tabs-bottom"><b></b></div>
	</div>
</section>